package ve.ejb.metadata;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class Color implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long idColor;

    @ManyToOne private ColorimetryScheme colorimetryScheme;

    @ManyToMany(targetEntity=ColorimetryStandard.class) @JoinTable(name="ColorimetryStandardColor", joinColumns=@JoinColumn(name="idColor"),
    inverseJoinColumns=@JoinColumn(name="idColorimetryStandard")) private Collection<ColorimetryStandard> colorimetryStandards;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    @Column(columnDefinition="text") private String color;

    private Long priority;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
    
    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Long getPriority() {
        return priority;
    }

    public void setPriority(Long priority) {
        this.priority = priority;
    }

    public Collection<ColorimetryStandard> getColorimetryStandards() {
        return colorimetryStandards;
    }

    public void setColorimetryStandards(Collection<ColorimetryStandard> colorimetryStandards) {
        this.colorimetryStandards = colorimetryStandards;
    }

    public ColorimetryScheme getColorimetryScheme() {
        return colorimetryScheme;
    }

    public void setColorimetryScheme(ColorimetryScheme colorimetryScheme) {
        this.colorimetryScheme = colorimetryScheme;
    }

    public Long getIdColor() {
        return idColor;
    }

    public void setIdColor(Long idColor) {
        this.idColor = idColor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idColor != null ? idColor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Color)) {
            return false;
        }
        Color other = (Color) object;
        if ((this.idColor == null && other.idColor != null) || (this.idColor != null && !this.idColor.equals(other.idColor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.Color[id=" + idColor + "]";
    }

}//ends of class
